package com.blustreaksw.DragNDrop;

import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.app.DialogFragment;

public class ConfirmationDialogFragment extends DialogFragment {
	
	private String mDialogTitle;
	private String mDialogMessage;
	private DialogInterface.OnClickListener mOkListener;
	private DialogInterface.OnClickListener mCancelListener;
	private Context mContext;
	
	public ConfirmationDialogFragment() {}
	
	public ConfirmationDialogFragment configureDialog(
			DialogInterface.OnClickListener ok,
			DialogInterface.OnClickListener cancel,
			String title, String message, Context c) {
		mDialogMessage = message;
		mDialogTitle = title;
		mOkListener = ok;
		mCancelListener = cancel;
		mContext = c;
		return this;
	}
	
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
		builder.setTitle(mDialogTitle)
			.setMessage(mDialogMessage)
			.setPositiveButton("Okay", mOkListener)
			.setNegativeButton("Cancel", mCancelListener);
		return builder.create();
	}
}
